import {
    SET_WEIGHT
} from '../mutation-types';
import api from '../../api';

// import { errFun } from "../../tools.js"

const state = {
    weight: '',
}

const mutations = {
    [SET_WEIGHT](state, weight) {
        state.weight = weight;
    }
}

// ACTION
const actions = {
    GET_WEIGHT: ({ commit, dispatch }) => {
        //让loading界面显示
        // dispatch('CHANGE_LOADING_SHOW').then(
        api.getUserInfo().then(response => {
            // console.log(response.data.user.weight)
            commit(SET_WEIGHT, response.data.user.weight);
            // 关闭loading界面
            // dispatch('CHANGE_LOADING_SHOW');
        })

        // )

    }
}

export default {
    state,
    actions,
    mutations
}